import request from '../utils/request'

// 根据id查询用户
export function getById(id){
    return request.get(`/users/${id}`)
}

// 获取用户列表
export function getList(params){
    return request.get('/users',{params:params})
}

// 添加用户
export function addUser(data){
    return request.post('/users',data)
}

// 修改用户
export function modUser(id,data){
    return request.put(`/users/${id}`,data)
}
// 修改用户状态
export function vimUser(id,delivery){
    return request.post(`/users/IsActived/${id}`, delivery);
}
// 修改用户是否为管理员
export function isAdmin(id,delivery){
    return request.post(`/users/IsManagement/${id}`, delivery);
}
//登录获取token
export function login(data){
    return request.post('/users/token',data)
}
// 注册用户
export function register(data) {
  console.log(data);
  return request.post("/users/register", data);
}
//删除用户
export function deleteUser(id, data) {
  return request.delete(`/users/${id}`, data);
}

